use rocket_dyn_templates::{context, Template};

#[get("/")]
pub fn index() -> Template {
    Template::render("index", context!{
        title: "实验数据处理——二维目标追踪、刺激建模和策略生成系统"
    })
}

#[get("/start_guide")]
pub fn start_guide() -> Template {
    Template::render("start_guide", context!{})
}

#[get("/running")]
pub fn running() -> Template {
    Template::render("running", context!{})
}

#[get("/dashboard")]
pub fn dashboard() -> Template {
    Template::render("dashboard", context!{})
}

#[get("/services")]
pub fn services() -> Template {
    Template::render("services", context!{})
}

#[get("/workflow")]
pub fn workflow() -> Template {
    Template::render("workflow", context!{})
}

#[get("/test")]
pub fn test() -> Template {
    Template::render("test_page", context!{})
}

mod doc {
    use rocket_dyn_templates::{context, Template};

    macro_rules! doc_routing {
        ($name:ident, $path:expr, $title:expr) => {
            #[get($path)]
            pub fn $name() -> Template {
                Template::render("doc/doc_page", context!{
                    title: $title,
                    path: $path
                })
            }
        };
    }

    doc_routing!(calib, "/calib", "标定(calibration)");
    doc_routing!(service, "/service", "服务(service)");
    doc_routing!(types, "/types", "类型(types)");
    doc_routing!(user_defined_service, "/user_defined_service", "用户自定义服务(user_defined_service)");
    doc_routing!(future, "/future", "未来特性(future)");
}

pub use doc::*;
